<?php
/**
 * Created by PhpStorm.
 * User: mingzhongshui
 * Date: 2020/3/31
 * Time: 21:09
 */

namespace App\Repositories;

use Prettus\Repository\Eloquent\BaseRepository;

abstract class Repository extends BaseRepository
{

    /**
     * @param $id
     * @param array $columns
     * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
     */
    public function firstByKey($id, $columns = ['*'])
    {
        return $this->model->newModelQuery()->whereKey($id)->first($columns);
    }

}
